<template>
<div class="layerRtb layerRtb-threecolumn">
    <three-title :title="{name:'工程会信息'}"></three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137">
        <div class="analyItem">
            <p class="analyItemTit tx-center">工程会</p>
            <div class="analyItemCon">
                <p class="col-md-10">
                    <span class="col-md-1 cLightGray ">说明</span>
                    <span  class="col-md-8 lh20">
                        <el-input  v-model="input"  placeholder="暂无"></el-input>
                    </span>
                </p>
                <p class="col-md-2">
                    <el-button @click="confirm(10,input)" type="primary">确定</el-button>
                </p>
                     <span style="top:20%" :class="['circlemark', GChList.isPresence==null ? 'circlemark-purple' : 'circlemark-lightGreen']" >{{GChList.isPresence==null?'待':'完'}}</span>

            </div>
        </div>
    </div>
    <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
                <p class="col-md-10">
                    <span class="cLightGray pr8">生产会</span>
                    <span class="cPurple pr8">
                        {{inputBottom}}
                    </span>
                </p>
                <p class="col-md-10">
                    <span class="col-md-1 cLightGray ">备注</span>
                    <span  class="col-md-8 lh20">
                        <el-input v-model="inputHandel"  placeholder="请输入处理备注..."></el-input>
                    </span>
                </p>
                     <span style="top:20%" :class="['circlemark', GCList.isPresence==null ? 'circlemark-purple' : 'circlemark-lightGreen']" >{{GCList.isPresence==null?'待':'完'}}</span>

            </div>
        </div>
        <div class="tx-center">
            <el-button  @click="confirm(3,inputHandel)" type="primary">保存</el-button>
        </div>
    </div>

</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { saveManageTrain } from '../../Resources/Api'

export default {
    data () {
        return {
            input: '',
            inputBottom: '',

            inputHandel: '',
            GCList: {},
            GChList: {}
        }
    },
    created () {
        this.GCList = this.$route.query.GCList
        this.break()
    },
    computed: {
        ...mapGetters(['leftInfo', 'userInfo'])
    },
    methods: {
        break () {
            // 综合备注
            if (this.GCList.isPresence !== null) {
                this.inputHandel = this.GCList.isPresence[0].remake
            }
            this.GCList.trainMediumType.forEach(element => {
                if (Number(element.exclusiveId) === 10) {
                    this.$nextTick(() => {
                        this.GChList = element
                    })
                    // 备注
                    if (element.isPresence !== null) {
                        this.$nextTick(() => {
                            this.input = this.inputBottom = element.isPresence[0].remake
                        })
                    }
                }
                console.log(this.GChList + '1233')
            })
        },
        confirm (val, input) {
            if (input === '') {
                layer.msg('输入备注')
                return
            } if (val === 3) {
                if (this.GChList.isPresence === null) {
                    layer.msg('尚未完善信息')
                    return
                }
            }

            saveManageTrain({
                user_card_no: this.leftInfo.cardNo, // 卡号
                userName: this.leftInfo.userName, // 姓名
                remake: input, // 备注
                operatorCard: this.userInfo.as_cardNo, // 操作人
                operatorName: this.userInfo.as_userName, // 操作人姓名
                exclusiveId: val // 专属ID
            }).then(res => {
                if (Number(res.data.StatusCode) === 0) {
                    layer.msg('保存成功')
                }
            }).catch(error => {
                console.log(error)
            })
        },
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        }
    },
    watch: {
        $route () {
        }
    }
}
</script>
<style lang="scss" scoped>
.pointer {
  cursor: pointer;
}
</style>
